﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DaoYou.Web.Guider.Account;

namespace DaoYou.Web.Account
{
    public partial class UserOrder : PageBase
    {
        protected List<RenChangYou.Model.DY_OrderDetail> CalendarList = new List<RenChangYou.Model.DY_OrderDetail>();

        protected void Page_Load(object sender, EventArgs e)
        {
            string where = string.Empty;

            if (base.UserType == 1)
            {
                //导游
                where = string.Format(" GuideUserName = '{0}' and EndDate >= '{1}' ", base.Account, DateTime.Today.Date);
            }
            else if (base.UserType == 0 || base.UserType == 2)
            {
                //顾客或者员工
                where = string.Format(" OrderNo in (select OrderNo from dbo.DY_Order with (nolock) where CustomerUserName = '{0}' ) and EndDate >= '{1}' ", base.Account, DateTime.Today.Date);
            }

            if (!string.IsNullOrWhiteSpace(where))
            {
                RenChangYou.BLL.DY_OrderDetail bll = new RenChangYou.BLL.DY_OrderDetail();

                List<RenChangYou.Model.DY_OrderDetail> list = bll.GetModelList(where);

                if (list != null && list.Count > 0)
                {
                    this.CalendarList = list;
                }
            }
        }

    }
}